<?php

use Erp\pockets\ErpConf;

/**
 * @deprecated
 */
class NipponAction extends ErpActionPlugin implements ErpConf
{

    public function main()
    {

        $sign = $this->getRequest()->getPost('sign');
        $method = $this->getRequest()->getPost('method', '');//logistics.offline.send
        $order_bn = $this->getRequest()->getPost('order_bn', '');
        $logistic_code = $this->getRequest()->getPost('logistic_code', '');
        $express_no = $this->getRequest()->getPost('express_no', '');
        $goods = $this->getRequest()->getPost('goods');

        $params = compact('method', 'order_bn', 'logistic_code', 'express_no', 'goods');

        \Doraemon\tools\Log::debug('立邦原始请求数据', compact('method', 'sign', 'order_bn', 'logistic_code', 'express_no', 'goods'));

        if (empty($order_bn)) throw new \Exception('订单号不能为空');
        if (empty($goods)) throw new \Exception('发货商品信息不能为空');
        if (empty($logistic_code)) throw new \Exception('快递公司不能为空');

        \Biz\service\erp\Nippon::index($method, $params, $sign);

        $this->setSuccess('success');
    }
}